<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="org.apache.shiro.web.filter.authc.FormAuthenticationFilter"%>
<%@ page import="org.apache.shiro.authc.ExcessiveAttemptsException"%>
<%@ page import="org.apache.shiro.authc.IncorrectCredentialsException"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>

<html>
<head>
	<title>登录页</title>
	<meta charset="UTF-8">
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=yes">
	<title>UNICORN</title>
	<link type="image/x-icon" href="${ctx}/static/images/favicon.ico" rel="shortcut icon">
	<link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
	<link rel="stylesheet" href="${ctx}/static/css/font-awesome.css">
	<link rel="stylesheet" href="${ctx}/static/css/base.css">
	<script src="${ctx}/static/jquery/jquery-1.9.1.min.js" type="text/javascript"></script>
	<link href="${ctx}/static/jquery-validation/1.11.1/validate.css" type="text/css" rel="stylesheet"/>
	<script src="${ctx}/static/jquery-validation/1.11.1/jquery.validate.min.js" type="text/javascript"></script>
	<script src="${ctx}/static/jquery-validation/1.11.1/messages_bs_zh.js" type="text/javascript"></script>
</head>

<body>
<div id="navbarAffix" class="navbar-static-top" data-spy="affix">
<div class="container">
	<a class="navbar-brand" href="javascript:void(0);"></a>
	<ul class="navbar-nav">
		<!--
			<li ><a href="${ctx}/">首页</a></li>
			-->
		<!--
		<shiro:notAuthenticated>
			<li><a href="${ctx}/register">注册</a></li>
			<li><a href="${ctx}/login">登录</a></li>
		</shiro:notAuthenticated>

        <li class="active"><a href="#">移动</a></li>
        <li><a href="#">指南</a></li>
        -->
	</ul>
	<!--
	<ul class="navbar-nav navbar-nav-right">
		<li>
			<a href="#">找回密码？</a>
		</li>
	</ul>
	-->
	<div class="login">
		<form id="loginForm" action="${ctx}/login" method="post" class="form-horizontal">
			<%
				String error = (String) request.getAttribute(FormAuthenticationFilter.DEFAULT_ERROR_KEY_ATTRIBUTE_NAME);
				if(error != null){
			%>
			<div class="alert alert-success alert-dismissable" style="text-align: center;">
				<button type="button" class="close" data-dismiss="alert" aria-hidden="true">
					×
				</button>
				登录失败，请重试.
			</div>
			<%
				}
			%>

			<h2 class="page-title">登录</h2>
			<div class="form-group">
				<div class="form-item">
					<span class="input-group-addon"><i class="fa fa-user" aria-hidden="true"></i></span>
					<input type="text" class="form-control" id="username" name="username" value="" placeholder="手机">
				</div>
				<div class="form-item">
					<span class="input-group-addon"><i class="fa fa-lock" aria-hidden="true"></i></span>
					<input type="password" class="form-control" id="password" name="password" value=""  placeholder="密码">
				</div>

				<div class="form-item">
					<!--
					<p class="help-block text-right"><a href="#">忘记登入密码？</a></p>
					-->
				</div>
				<div>
					<button class="btn">登录</button>
				</div>
			</div>
			<div class="form-group">
				<div class="form-item">
					<p class="help-block text-right"><a href="${ctx}/register">注册</a></p>
				</div>
			</div>
		</form>
	</div>
</div>
</div>
	<script>
		$(document).ready(function() {
			$("#loginForm").validate();
		});
	</script>
</body>
</html>
